import router from './index'
//导入store
import store from '../store/index'
//路由拦截
router.beforeEach((to,from,next)=>{
    //1.判断当前的路由是否需要登录
    if(to.meta.isLogin){
      //2.判断当前的用户状态是否已登录
      let token = store.state.LoginModule.userinfo.token;
      if(token){
        next()
      }else{
        next('/login')
      }
    }else{//不需要登录
      next()
    }
})